#ifndef _STDIO_H
#define _STDIO_H

#define EOF (-1)


#ifndef NULL
#define NULL ((void *) 0)
#endif



/*
 * Funcin: getchar
 * ----------------
 * Descripcin de la GNU C Library (http://www.gnu.org/software/libc/):
 * This function reads the next character as an unsigned char from stdin
 * and returns its value, converted to an int. If an end-of-file condition
 * or read error occurs, EOF is returned instead.
 */
int getchar(void);

/*
 * Funcin: putchar
 * ----------------
 * Descripcin de la GNU C Library (http://www.gnu.org/software/libc/):
 * This function converts the character c to type unsigned char, and writes
 * it to stdout. EOF is returned if a write error occurs; otherwise the
 * character c is returned.
 */
int putchar(int c);
int putChar(int c);
/*
 * Funcin: puts
 * -------------
 * Descripcin de la GNU C Library (http://www.gnu.org/software/libc/):
 * This function writes the string s to stdout. The terminating null
 * character is not written. This function does not add a newline character,
 * either. It outputs only the characters in the string.
 * This function returns EOF if a write error occurs, and otherwise a
 * non-negative value.
 */
int puts(const char *s);

/*
 * Funcin: printf
 * ---------------
 * Descripcin de la GNU C Library (http://www.gnu.org/software/libc/):
 * The printf function prints the optional arguments under the control of
 * the template string template to the stream stdout. It returns the number
 * of characters printed, or a negative value if there was an output error.
 *
 * Notas de implementacin:
 * La implementacin de las conversiones del template no es completa.
 * Soporta las conversiones ms comunes:
 * %c, %d, %i, %o, %p, %s, %u, %x, %X, %%
 * No soporta las conversiones de nmeros de punto flotante:
 * %f, %g, %G, %e, %E, %a, %A
 * No soporta modificadores de tipos como h, l, L, etc.
 * Soporta ancho mnimo, precisin y la mayora de los flags: "-+ #0'".
 * La implementacin es escalable para otros tipos y modificadores.
 */
int printf(const char *c, ...);

/*
 * Funcin: print_int
 * ------------------
 * Imprime por "salida estndar" un nmero entero.
 * Es casi equivalente a printf("%d", num) pero ms eficiente.
 */
int print_int(int num);

/*
 * Funcin: getsn
 * --------------
 * Esta funcin es similar a gets, slo que lee a lo sumo n caracteres y
 * luego vaca el buffer. Por compatibilidad con la implementacin actual
 * de stdin en la que getchar que no devuelve EOF (UNIX-like), se
 * considera '\n' como un EOF. A continuacin se describe gets.
 * Descripcin de la GNU C Library (http://www.gnu.org/software/libc/):
 * The function gets reads characters from stdin up to the next newline
 * character, and stores them in the string s. The newline character is
 * discarded (note that this differs from the behavior of fgets, which
 * copies the newline character into the string). If gets encounters a
 * read error or end-of-file, it returns a null pointer; otherwise it
 * returns s.
 */
int getsn(char *s, unsigned int n);

/*
 * Funcin: getint
 * ---------------
 * Esta funcin lee de stdin caracteres que convierte a un nmero entero.
 * La conversin funciona como atoi.
 */
int getint(void);


#endif /* _STDIO_H */

